需要"设成首页"的代码

来源:百度知道 编辑:UC知道 时间:2024/09/28 13:26:30

1.文字型:
<a onclick="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’http://zhidao.baidu.com);" href="#">设为首页</a>
范例:
设为首页

2.按钮型:
<input TYPE="button" VALUE=" 设为首页 " onclick="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’http://zhidao.baidu.com’);" href="#">

离开时自动提示设为首页

<body onunload="BASEBody.style.behavior=’url(#default#homepage)’;if(!(BASEBody.isHomePage(’http://zhidao.baidu.com’)))BASEBody.setHomePage(’http://zhidao.baidu.com’);">

在站点文件中编辑代码
<sitemap homepage="主页路径"/&